package xdpm.nhom16.DAO;

import xdpm.nhom16.DTO.TuKhoaDichVuDTO;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

public class TuKhoaDichVuDAO extends AbstractTuKhoaDAO<TuKhoaDichVuDTO> {

	protected static final String TABLE_NAME = "TUKHOADICHVU";
	protected static final String COLUMN_ID = "MaTuKhoaDichVu";
	protected static final String COLUMN_TUKHOA = "TuKhoaDichVu";
	protected static final String COLUMN_PARENT = "MaDichVu";
	protected static final String[] COLUMNS_NAME = new String[] { COLUMN_ID, COLUMN_TUKHOA, COLUMN_PARENT };

	public TuKhoaDichVuDAO(SQLiteDatabase db) {
		super(db);
	}

	@Override
	protected String getTableName() {
		return TABLE_NAME;
	}

	@Override
	protected String getNameColumnId() {
		return COLUMN_ID;
	}

	@Override
	protected String[] getNameColumns() {
		return COLUMNS_NAME;
	}

	@Override
	protected TuKhoaDichVuDTO cusorToDTO(Cursor cursor) {
		int id = cursor.getInt(0);
		TuKhoaDichVuDTO dto = new TuKhoaDichVuDTO();
		dto.set_maTuKhoaDichVu(id);
		if (!cursor.isNull(1))
			dto.set_tuKhoaDichVu(cursor.getString(1));
		if (!cursor.isNull(2))
			dto.set_maDichVu(cursor.getInt(2));
		return dto;
	}

	@Override
	protected String getNameColumnTuKhoa() {
		// TODO Auto-generated method stub
		return COLUMN_TUKHOA;
	}

	@Override
	protected String getNameColumnRefIdParent() {
		// TODO Auto-generated method stub
		return COLUMN_PARENT;
	}
}